# Contributor: Rasmus Thomsen <oss@cogitri.dev>
# Maintainer: Rasmus Thomsen <oss@cogitri.dev>
pkgname=xdg-desktop-portal
pkgver=1.14.4
pkgrel=1
pkgdesc="Desktop integration portal"
url="https://github.com/flatpak/xdg-desktop-portal"
# s390x blocked by pipewire
# riscv64 blocked by polkit -> flatpak
arch="all !riscv64 !s390x"
license="LGPL-2.1-or-later"
depends="bubblewrap cmd:fusermount3"
makedepends="
	autoconf
	automake
	flatpak
	flatpak-dev
	fontconfig-dev
	fuse3-dev
	geoclue-dev
	gettext-dev
	glib-dev
	json-glib-dev
	libtool
	pipewire-dev
	xmlto
	"
checkdepends="dbus libportal-dev"
subpackages="$pkgname-lang $pkgname-doc"
source="https://github.com/flatpak/xdg-desktop-portal/releases/download/$pkgver/xdg-desktop-portal-$pkgver.tar.xz"

prepare() {
	default_prepare

	autoreconf -fi
}

build() {
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--sysconfdir=/etc \
		--mandir=/usr/share/man \
		--localstatedir=/var \
		--enable-docbook-docs \
		--without-systemd
	make
}

check() {
	make check
}

package() {
	make DESTDIR="$pkgdir" install

	cd "$pkgdir"

	# We don't need this
	rm -rf usr/lib/systemd

	mkdir -p usr/lib
	mv usr/share/pkgconfig usr/lib/
}

sha512sums="
23fa4f9fdf39f22d6eaa4f6020db5f81d272b85fe6051467c5e28a752c65b18a9b540fafe5b27725fafa29dffefcd113d873928cd78e3658895cd24d96b82f73  xdg-desktop-portal-1.14.4.tar.xz
"
